/*
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2025-07-25 10:12:39
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2025-07-30 18:52:49
 * @FilePath: /yyshort/lib/common/apis/home_api.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:yyshort/common/model/banner_model.dart';
import 'package:yyshort/common/model/recommend_list_model.dart';
import 'package:yyshort/common/model/video_model.dart';
import 'package:yyshort/common/utils/http.dart';

class HomeAPI {
  /// @description: 轮播图
  /// @return {*}
  static Future home_banner() async {
    var response = await HttpUtil().post('/home_banner');
    BannerListModel bannerListModel = BannerListModel.fromJson(response);
    return bannerListModel.list;
  }

  /// @description: 推荐列表
  /// @return {*}
  static Future home_recommend() async {
    var response = await HttpUtil().post('/home_recommend');
    RecommendResponesModel recommendResponesModel =
        RecommendResponesModel.fromJson(response);
    return recommendResponesModel.list;
  }

  /// @description: 首页瀑布流
  /// @param {String} page 分页，每页20条（必填，默认1）
  /// @return {*}
  static Future home_waterfall({required String page}) async {
    Map<String, dynamic> params = {"page": page};
    var response = await HttpUtil().post('/home_waterfall', data: params);
    VideoListModel listModel = VideoListModel.fromJson(response);
    return listModel.list;
  }
}
